package baseTest;

import java.util.Arrays;

public class uniquePaths {
    public static void main(String[] args) {
        System.out.println(process(3,7));
    }

    public static int process(int m,int n){
        if (m == 1 && n == 1){
            return 1;
        }
        if (m <= 0 || n <= 0){
            return 0;
        }

        return process(m-1,n)+process(m,n-1);
    }

    public static int process2(int m,int n){
        int[][] ans = new int[m][n];
        Arrays.fill(ans[0],1);
        for (int i = 0; i < ans.length; i++) {
            ans[i][0] = 1;
        }
        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++) {
                ans[i][j] = ans[i-1][j] + ans[i][j-1];
            }
        }
        return ans[m-1][n-1];
    }
}
